﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using AttributeRouting;
using AttributeRouting.Web.Mvc;
using PH.Model.Achievements;
using PH.Logic.Achievements;
namespace PH.Web.Management.Areas.Achievements.Controllers
{
    [RouteArea("Achievements")]
    [RoutePrefix("Archive")]
    [Authorize]
    public class ArchiveController : Controller
    {
        [Route("")]
        public ActionResult Index()
        {
            return View();
        }

        [Route("Edit/{guid:guid?}")]
        public ActionResult Edit(Guid? guid)
        {
            ArchiveModel model;
            if (guid == null)
                model = new ArchiveModel();
            else
                model = ArchiveLogic.GetModel(guid.Value);
            //ViewBag.SchoolList = Logic.Schools.SchoolLogic.GetSchools(new Model.Schools.SchoolQuery() { BureauID = Web.Global.WebContext.CurrentUser.AssociatedBureauID.Value });
            return PartialView(model);
        }

        [Route("InSchool")]
        [Filters.CurrentSchool]
        public ActionResult InSchool()
        {
            return View();
        }

        [Route("InSchoolEdit/{schGuid:guid}/{guid:guid?}")]
        public ActionResult InSchoolEdit(Guid schGuid, Guid? guid)
        {
            ViewBag.MySchool = schGuid;
            ArchiveModel model = null;
            if (guid == null)
                model = new ArchiveModel();
            else
                model = ArchiveLogic.GetModel(guid.Value);
            return PartialView(model);
        }
    }
}
